package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.UserService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 * 
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/user/")
public class UserController {

    @Autowired
    UserService userService;

    /**
   * D1-查账号公共信息详情
   */
    @PostMapping("queryPublicInfoDetail")
    public OkrResult<QueryPublicInfoDetailRespDto> queryPublicInfoDetail(@RequestBody @Validated QueryPublicInfoDetailReqDto reqDTO){
    return OkrResult.success(userService.queryPublicInfoDetail(reqDTO));
    }

    /**
   * D1-2新增联盟用户(公共)
   */
    @PostMapping("addUsersUnion")
    public OkrResult<AddUsersUnionRespDto> addUsersUnion(@RequestBody @Validated AddUsersUnionReqDto reqDTO){
    return OkrResult.success(userService.addUsersUnion(reqDTO));
    }

    /**
   * D1-2修改个人账号
   */
    @PostMapping("updateUser")
    public OkrResult<UpdateUserRespDto> updateUser(@RequestBody @Validated UpdateUserReqDto reqDTO){
    return OkrResult.success(userService.updateUser(reqDTO));
    }

    /**
   * D1-2查询个人信息列表
   */
    @PostMapping("queryPersonalInformationList")
    public OkrResult<QueryPersonalInformationListRespDto> queryPersonalInformationList(@RequestBody @Validated QueryPersonalInformationListReqDto reqDTO){
//    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryPersonalInformationListRespDto retData = userService.queryPersonalInformationList(reqDTO);

//        retData.setPageNum(page.getPageNum());
//        retData.setPageSize(page.getPageSize());
//        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-2修改手机号
   */
    @PostMapping("updateChangePhone")
    public OkrResult<UpdateChangePhoneRespDto> updateChangePhone(@RequestBody @Validated UpdateChangePhoneReqDto reqDTO){
    return OkrResult.success(userService.updateChangePhone(reqDTO));
    }

    /**
   * D1-2修改个人资料
   */
    @PostMapping("updateUserInfo")
    public OkrResult<UpdateUserInfoRespDto> updateUserInfo(@RequestBody @Validated UpdateUserInfoReqDto reqDTO){
    return OkrResult.success(userService.updateUserInfo(reqDTO));
    }

    /**
   * D1-2查询个人资料详情
   */
    @PostMapping("queryUserInfoDetail")
    public OkrResult<QueryUserInfoDetailRespDto> queryUserInfoDetail(@RequestBody @Validated QueryUserInfoDetailReqDto reqDTO){
    return OkrResult.success(userService.queryUserInfoDetail(reqDTO));
    }

    /**
   * D1-2查询个人账号详情
   */
    @PostMapping("queryUserDetail")
    public OkrResult<QueryUserDetailRespDto> queryUserDetail(@RequestBody @Validated QueryUserDetailReqDto reqDTO){
    return OkrResult.success(userService.queryUserDetail(reqDTO));
    }

    /**
   * D1-2首次登录完善个人资料
   */
    @PostMapping("addRenewUserInfo")
    public OkrResult<AddRenewUserInfoRespDto> addRenewUserInfo(@RequestBody @Validated AddRenewUserInfoReqDto reqDTO){
    return OkrResult.success(userService.addRenewUserInfo(reqDTO));
    }

    /**
   * D1-2查询联盟用户列表
   */
    @PostMapping("queryUsersUnionDetail")
    public OkrResult<QueryUsersUnionDetailRespDto> queryUsersUnionDetail(@RequestBody @Validated QueryUsersUnionDetailReqDto reqDTO){
    return OkrResult.success(userService.queryUsersUnionDetail(reqDTO));
    }

    /**
   * D1-2查询个人信息详情
   */
    @PostMapping("queryPersonalInformationDetail")
    public OkrResult<QueryPersonalInformationDetailRespDto> queryPersonalInformationDetail(@RequestBody @Validated QueryPersonalInformationDetailReqDto reqDTO){
    return OkrResult.success(userService.queryPersonalInformationDetail(reqDTO));
    }

    /**
     * D1-2注销个人账号
     */
    @PostMapping("deleteUser")
    public OkrResult<DeleteUserRespDto> deleteUser(@RequestBody @Validated DeleteUserReqDto reqDTO) {
        return OkrResult.success(userService.deleteUser(reqDTO));
    }

    /**
   * D1-查询用户登录信息（非Redis）
   */
    @PostMapping("queryUserInfoByLoginDetail")
    public OkrResult<QueryUserInfoByLoginDetailRespDto> queryUserInfoByLoginDetail(@RequestBody @Validated QueryUserInfoByLoginDetailReqDto reqDTO){
    return OkrResult.success(userService.queryUserInfoByLoginDetail(reqDTO));
    }
/**
   * D1-2查询个人资料详情(公共)
   */
    @PostMapping("queryUserInfoDetailCom")
    public OkrResult<QueryUserInfoDetailComRespDto> queryUserInfoDetailCom(@RequestBody @Validated QueryUserInfoDetailComReqDto reqDTO){
    return OkrResult.success(userService.queryUserInfoDetailCom(reqDTO));
    }
/**
   * D1-查询公共信息详情(公共)
   */
    @PostMapping("queryPublicInfoDetailCom")
    public OkrResult<QueryPublicInfoDetailComRespDto> queryPublicInfoDetailCom(@RequestBody @Validated QueryPublicInfoDetailComReqDto reqDTO){
    return OkrResult.success(userService.queryPublicInfoDetailCom(reqDTO));
    }
/**
   * D1-执行登录验证(公共)
   */
    @PostMapping("implementSignInCheckCom")
    public OkrResult<ImplementSignInCheckComRespDto> implementSignInCheckCom(@RequestBody @Validated ImplementSignInCheckComReqDto reqDTO){
    return OkrResult.success(userService.implementSignInCheckCom(reqDTO));
    }
/**
   * D1执行登录验证处理数据(公共)
   */
    @PostMapping("implementSignIncheckProcessingDataCom")
    public OkrResult<ImplementSignIncheckProcessingDataComRespDto> implementSignIncheckProcessingDataCom(@RequestBody @Validated ImplementSignIncheckProcessingDataComReqDto reqDTO){
    return OkrResult.success(userService.implementSignIncheckProcessingDataCom(reqDTO));
    }
/**
   * D1-2新增男女尊称(公共)
   */
    @PostMapping("addSexNameCom")
    public OkrResult<AddSexNameComRespDto> addSexNameCom(@RequestBody @Validated AddSexNameComReqDto reqDTO){
    return OkrResult.success(userService.addSexNameCom(reqDTO));
    }
/**
   * D1-2查询个人密保问题(公共)
   */
    @PostMapping("queryUserPwdProblemDetailCom")
    public OkrResult<QueryUserPwdProblemDetailComRespDto> queryUserPwdProblemDetailCom(@RequestBody @Validated QueryUserPwdProblemDetailComReqDto reqDTO){
    return OkrResult.success(userService.queryUserPwdProblemDetailCom(reqDTO));
    }
/**
   * D1-2找回密码
   */
    @PostMapping("findPassword")
    public OkrResult<FindPasswordRespDto> findPassword(@RequestBody @Validated FindPasswordReqDto reqDTO){
    return OkrResult.success(userService.findPassword(reqDTO));
    }
/**
   * D1-2查询个人密保问题详情
   */
    @PostMapping("queryUserPwdProblemDetail")
    public OkrResult<QueryUserPwdProblemDetailRespDto> queryUserPwdProblemDetail(@RequestBody @Validated QueryUserPwdProblemDetailReqDto reqDTO){
    return OkrResult.success(userService.queryUserPwdProblemDetail(reqDTO));
    }
/**
   * D1-2查询账号详情(公共)
   */
    @PostMapping("queryUserDetailCom")
    public OkrResult<QueryUserDetailComRespDto> queryUserDetailCom(@RequestBody @Validated QueryUserDetailComReqDto reqDTO){
    return OkrResult.success(userService.queryUserDetailCom(reqDTO));
    }
/**
   * D1登录成功生成Token
   */
    @PostMapping("createToken")
    public OkrResult<CreateTokenRespDto> createToken(@RequestBody @Validated CreateTokenReqDto reqDTO){
    return OkrResult.success(userService.createToken(reqDTO));
    }
/**
   * D1-工号信息验证(公共)
   */
    @PostMapping("checkLoginNumber")
    public OkrResult<CheckLoginNumberRespDto> checkLoginNumber(@RequestBody @Validated CheckLoginNumberReqDto reqDTO){
    return OkrResult.success(userService.checkLoginNumber(reqDTO));
    }
/**
   * D1-执行统一认证登录验证(公共)
   */
    @PostMapping("implementUnifiedCertificationSignInCheckCom")
    public OkrResult<ImplementUnifiedCertificationSignInCheckComRespDto> implementUnifiedCertificationSignInCheckCom(@RequestBody @Validated ImplementUnifiedCertificationSignInCheckComReqDto reqDTO){
    return OkrResult.success(userService.implementUnifiedCertificationSignInCheckCom(reqDTO));
    }
/**
   * D1获取空间三方鉴权配置信息(公共)
   */
    @PostMapping("obtainSpaceThirdPartyAuthenticationConfInfoCom")
    public OkrResult<ObtainSpaceThirdPartyAuthenticationConfInfoComRespDto> obtainSpaceThirdPartyAuthenticationConfInfoCom(@RequestBody @Validated ObtainSpaceThirdPartyAuthenticationConfInfoComReqDto reqDTO){
    return OkrResult.success(userService.obtainSpaceThirdPartyAuthenticationConfInfoCom(reqDTO));
    }
/**
   * D1执行统一认证退出登录(公共)
   */
    @PostMapping("implementAuthLoginOutCom")
    public OkrResult<ImplementAuthLoginOutComRespDto> implementAuthLoginOutCom(@RequestBody @Validated ImplementAuthLoginOutComReqDto reqDTO){
    return OkrResult.success(userService.implementAuthLoginOutCom(reqDTO));
    }
/**
   * D1-获取统一认证用户信息(公共)
   */
    @PostMapping("obtainAuthAccountInfoCom")
    public OkrResult<ObtainAuthAccountInfoComRespDto> obtainAuthAccountInfoCom(@RequestBody @Validated ObtainAuthAccountInfoComReqDto reqDTO){
    return OkrResult.success(userService.obtainAuthAccountInfoCom(reqDTO));
    }
/**
   * D1-执行统一认证登录处理数据(公共)
   */
    @PostMapping("implementUnifiedCertificationSignInCheckProcessingDataCom")
    public OkrResult<ImplementUnifiedCertificationSignInCheckProcessingDataComRespDto> implementUnifiedCertificationSignInCheckProcessingDataCom(@RequestBody @Validated ImplementUnifiedCertificationSignInCheckProcessingDataComReqDto reqDTO){
    return OkrResult.success(userService.implementUnifiedCertificationSignInCheckProcessingDataCom(reqDTO));
    }
/**
   * D1-登录V3(公共)
   */
    @PostMapping("implementLoginCom")
    public OkrResult<ImplementLoginComRespDto> implementLoginCom(@RequestBody @Validated ImplementLoginComReqDto reqDTO){
    return OkrResult.success(userService.implementLoginCom(reqDTO));
    }
/**
   * D1批量查询个人资料(公共)
   */
    @PostMapping("batchQueryUserInfoCom")
    public OkrResult<BatchQueryUserInfoComRespDto> batchQueryUserInfoCom(@RequestBody @Validated BatchQueryUserInfoComReqDto reqDTO){
    return OkrResult.success(userService.batchQueryUserInfoCom(reqDTO));
    }
/**
   * D1拼第三方统一认证的登录地址
   */
    @PostMapping("queryObtainUnifiedAuthenticationLoginInformationDetailCom")
    public OkrResult<QueryObtainUnifiedAuthenticationLoginInformationDetailComRespDto> queryObtainUnifiedAuthenticationLoginInformationDetailCom(@RequestBody @Validated QueryObtainUnifiedAuthenticationLoginInformationDetailComReqDto reqDTO){
    return OkrResult.success(userService.queryObtainUnifiedAuthenticationLoginInformationDetailCom(reqDTO));
    }
/**
   * D1-查询第三方统一认证用户信息详情
   */
    @PostMapping("queryAuthAccountInfoDetail")
    public OkrResult<QueryAuthAccountInfoDetailRespDto> queryAuthAccountInfoDetail(@RequestBody @Validated QueryAuthAccountInfoDetailReqDto reqDTO){
    return OkrResult.success(userService.queryAuthAccountInfoDetail(reqDTO));
    }
/**
   * D1执行异步更新账号(公共)
   */
    @PostMapping("implementAsynUpdateUserCom")
    public OkrResult<ImplementAsynUpdateUserComRespDto> implementAsynUpdateUserCom(@RequestBody @Validated ImplementAsynUpdateUserComReqDto reqDTO){
    return OkrResult.success(userService.implementAsynUpdateUserCom(reqDTO));
    }
}
